package Presentation;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.border.LineBorder;
import javax.swing.text.PasswordView;

public class LoginPanel extends JPanel{
	
	private final JTextField usernameT;	
	private final JPasswordField passwordT;
	
	public LoginPanel(final MainFrame main){
		super();
		setSize(250,150);
		setLayout(null);
		setBorder(new LineBorder(Color.black));
		
		
		JLabel usernameL = new MyLabel("Username",75,20,20,20);
		add(usernameL);

		JLabel passwordL = new MyLabel("Password",75,20,20,60);
		add(passwordL);
		
		usernameT = new MyTextField(130,20,100, 20);
		add(usernameT);		
		
		passwordT = new JPasswordField();
		passwordT.setSize(130,20);
		passwordT.setLocation(100, 60);
		add(passwordT);
		
		JButton okB = new MyButton("OK",100,25,75,100);
		add(okB);
		okB.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				main.login(usernameT.getText(),passwordT.getPassword());
			}
		});		
	}

}
